Skip to content

docs: ATOMesh multimodal image requests and E/P/D disaggregation design - #3417

Open
junyyang-amd wants to merge 44 commits into
junyyang/mm-epd-h2from
junyyang/mm-epd-d1
Open

junyyang-amd wants to merge 44 commits into
junyyang/mm-epd-h2from
junyyang/mm-epd-d1

Conversation

@junyyang-amd

@junyyang-amd junyyang-amd commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Ready for review. No blocking issues. PR 8 of 8 in stack #3768: it merges after #3415, with the code it describes.

Why

A reviewer of the E/P/D stack had no written design to check it against. For example, #3409 sends an image request to prefill without embeddings when the encoder fails, and nothing in the repository said why that beats failing the request.

What changed

  • docs/atomesh_multimodal_epd.md walks each request flow as a diagram: single instance, image distinction, 1P1D, E/P/D, E/P/D when E cannot serve, Kimi-K3.1 and the CI case.
  • It records 20 decisions. Each names the PR that implements it, its basis in code or measurement, and the alternative rejected.
  • It maps acceptance items A1 to A8 to the PR where each result is posted, and lists the measurements the decisions rest on.
  • CLAUDE.md links it from the Detailed Guides table as the design of this stack.

Review focus

Testing

A documentation change. Code facts were checked against main at fe9b2f0 and the stack's heads on 2026-11-27.

Follow-ups

  • Recorded in the doc, not built: reclaiming an encoder entry on prefill's ack, and fetching embeddings at scheduling time.

junyyang-amd and others added 2 commits November 16, 2026 08:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every eligible PR before approval:

  • ✅ Pre Checkin: Black, Ruff, catalog schema validation, non-GPU unit tests

Heavy model tests:

  • ✅ Gate checks are published on every PR so required checks do not stay missing
  • ✅ Expensive jobs run only after the PR is approved, or when a matching ci:* label is present
  • ✅ Pre Checkin must pass before approved heavy jobs continue
  • ✅ Without a matching label, expensive jobs also require a relevant path
  • ✅ A matching ci:* label is an explicit request and can open the gate even when paths would otherwise skip it

Path scope:

  • Native ATOM, vLLM, and SGLang use ignore lists: docs/markdown and unrelated plugin or Mesh paths are skipped
  • ATOMesh uses an include list: Mesh code, ATOMesh scripts/workflows/catalogs, OpenAI entrypoints, and Slurm helpers
  • Relevant path alone does not start expensive jobs; approval still opens the automatic path-scoped gate
Label Tests
ci:full Run all heavy PR model tests: native ATOM, vLLM, SGLang, and ATOMesh
ci:atom Run native ATOM model accuracy tests
ci:vllm Run ATOM vLLM OOT model accuracy tests
ci:sglang Run ATOM SGLang model accuracy tests
ci:mesh Run ATOMesh accuracy/benchmark gates for Mesh-related changes

Without a matching ci:* label, heavy jobs are skipped when the path is not relevant or the PR is not approved.
Add labels via the sidebar or gh pr edit 3417 --add-label <label>

@valar-cop valar-cop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few small things..

ci green.

Comment thread docs/atomesh_multimodal_epd.md Outdated
fold the multimodal generator into `generate_async`, a larger change to the
text path project principle 2 keeps still.

**D5. Decode takes the pretokenized branch.** In `_chat_completions`, a

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_multimodal comes from the body, not multimodal_data.. so D5 as written still calls generate_async_multimodal with None. clear is_multimodal or gate on multimodal_data?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6597890: decode now clears is_multimodal, as #3410 does.

Comment thread docs/atomesh_multimodal_epd.md Outdated
- `atom/model_engine/scheduler.py`: `preempt` fails an image decode
sequence that holds no media (D6).
- `atom/config.py`, `atom/model_engine/arg_utils.py`: `encoder_only` (D10).
- `atom/utils/envs.py`: `ATOM_EC_LEASE_S` (D12).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ATOM_EC_LEASE_S should also be added to docs/environment_variables.md, other ATOM_* are there

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #3411: ATOM_EC_LEASE_S is in docs/environment_variables.md.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (5)

  1. Land this doc with the code it describes, not ahead of it. About half of it (E/P/D: D9-D17, ec_transfer_params, WorkerType::Encode, --encoder-only, ATOM_EC_LEASE_S) has no implementation in any open PR. The rest is written in present tense but exists only in unmerged #3407 (with_media_digests, policy_apply.rs decision event, can_chunk_request media check), #3410 (kv params through generate_async_multimodal, D-side cache_seed, preempt fail-fast) and #3414 (harness, build_kimi_k3_inputs cache_seed). Either trim it to what #3407/#3410/#3414 ship and merge it after them, or mark each decision Implemented (PR #) / Proposed. Move the E/P/D proposal to an issue until code exists.
  2. Make it readable outside your fork. docs/atomesh_multimodal_epd.md cites junyyang-amd/ATOM#N 35 times, sometimes as a decision's only basis (D8, D11, D14). It also cites "project principle 1-5", which no file defines, plus a fork/EPD 3c5f13508 checkout, g15, "owner-named node", "spike" and "umbrella". Inline the measured numbers and the rule each decision rests on, or link ROCm/ATOM issues.
  3. Make the Acceptance table match the harness. In #3414's tests/accept/atomesh_mm/ only m31 single mmstar|mmmu-pro|distinct (plus the direct topology) exist. There is no topologies/pd.sh or epd.sh, no models/k31.env, no checks/ttft.py or ci_case.py, and no image cell in models_atomesh.yaml, so A3(k31) and A4-A8 cannot run as written. Mark these commands as planned, or drop them.
  4. Fix the D4/D5 wording to match #3410. Line 234 says decode "takes the pretokenized branch before the is_multimodal check". #3410 instead clears is_multimodal when do_remote_prefill and the ids are present (api_server.py:2224), which is valar-cop's point. Line 219: the n>1 chat branch already passes kv_transfer_params on main (generate_async_fanout, api_server.py:2345). Only the single-image branches change.
  5. Remove the CLAUDE.md row, or mark it as a design. Every other row in that table points to a guide for a shipped feature. As written, this row tells agents that E/P/D exists.

Minor (details in review notes): D13 prefill_media_payload also drops image_grid_thw once leased. D12 should say E bumps the generation word before it overwrites the payload, and how P's TP ranks agree when only some of them fall back to the local tower. Mixed embeddings would diverge across ranks. D11 should say why the existing ATOM_MOONCAKE_MATCHED_RAILS mode (docs/mooncake_matched_rails.md) does not apply, since that doc warns that a multi-HCA engine can pick a disconnected rail. The changes-per-file list should add docs/environment_variables.md for ATOM_EC_LEASE_S (valar-cop). The PR description's "CPU unit suite" result says nothing about a docs-only change.


Reviewed at 3cf746b. Docs-only; checks green (heavy CI skipped as expected), RTD build passes.

@valar-cop

Copy link
Copy Markdown

@junyyang-amd
junyyang-amd changed the base branch from main to junyyang/mm-epd-h3 November 22, 2026 15:04
@junyyang-amd
junyyang-amd added this pull request to stack #3699 November 22, 2026 15:05

@valar-cop valar-cop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some changes needed..

atomesh_multimodal_epd.md:234 — D5 mechanism is off: is_multimodal is cleared when leaves_media_on_prefill (do_remote_prefill + cache_seed), not pretokenized before the check. also n>1 in D4 already on main..

atomesh_multimodal_epd.md:3 — can't read this outside your fork: fork-only issue links, undefined principles and terms (g15, spike, umbrella). inline the numbers and cite ROCm/ATOM instead?

ci green.

Comment thread docs/atomesh_multimodal_epd.md Outdated
router and hash bytes, which adds image decoding to the Rust hot path for a
hit rate no acceptance item asks for.

**D3. Decision observability is one `debug` tracing event per selection.**

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D3 says shipped but nothing emits the routing decision line with key_hash that checks/distinct.py parses.. mark it proposed or land the event?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6597890: this decision now reads the mesh::route "Selected worker" event #3407 emits, and A3 checks its match_ratio.

Comment thread docs/atomesh_multimodal_epd.md Outdated
fold the multimodal generator into `generate_async`, a larger change to the
text path project principle 2 keeps still.

**D5. Decode takes the pretokenized branch.** In `_chat_completions`, a

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verified] D5 misstates the mechanism: the decode does not take pretokenized 'before the is_multimodal check'; api_server.py:2282 computes is_multimodal and clears it when leaves_media_on_prefill (sequence.py:192: do_remote_prefill + cache_seed, not prompt_token_ids, as the gate). D4 (line 219) also lists n>1 as newly passing kv_transfer_params, but generate_async_fanout already had it on main. Rewrite D5 to describe the is_multimodal clearing and the do_remote_prefill+cache_seed predicate, and scope D4's change list to the single-image branches.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6597890: the decode decision now names the leaves_media_on_prefill clearing, and the generator decision lists only the single-request branch.

Comment thread docs/atomesh_multimodal_epd.md Outdated
@@ -0,0 +1,562 @@
# ATOMesh multimodal image requests and E/P/D disaggregation

Design for junyyang-amd/ATOM#2: image chat requests through ATOMesh for

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verified] Unreadable outside the author's fork: 35 junyyang-amd/ATOM#N links and zero ROCm/ATOM ones, 5 'project principle 1-5' citations no file defines, a fork/EPD 3c5f13508 checkout, and undefined g15 / owner-named node / spike / umbrella; D8, D11 and D14 rest only on these. Maintainer item 2, still open. Inline the measured numbers and the rule behind each principle, define or link the terminology, and cite ROCm/ATOM issues or inline the spike evidence.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6597890: no fork reference remains. The measurements and rules are inline, and the nodes are defined.

junyyang-amd and others added 6 commits November 23, 2026 05:55
Brings h1's route-log distinction check here. distinct.py keeps h3's
three requests and prefix-cache comparison, and reads the routing keys
off the `mesh::route` "Selected worker" event: media_count 1 on each,
blue match_ratio below 1, the second red one 1. epd.sh counts image
requests on the same event (`pool="prefill"`, `media_count` >= 1) with
the route log on, instead of the `routing decision ... media_digests`
event the router no longer emits. k31.env takes the same newer image as
m31.env.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses the review of #3417:
- Each decision names the PR of the stack that implements it (#3410,
  #3407, #3411-#3413, #3408, #3409, #3414-#3416); the Acceptance table
  names the PR that adds each check.
- No reference outside ROCm/ATOM remains: the requirement, the
  measurements and the rules decisions rest on are stated in place.
- D4/D5 follow #3410: decode clears `is_multimodal` when P kept the
  media; only the non-streaming single branch returns `cache_seed`.
- D6 names the scheduler's actual refusal of a media-less local prefill.
- D3 and A3 describe the route-log `match_ratio` check.
- D11 says why matched rails do not apply; D12 states E's word handling
  as implemented, the 503 on a full pool, and the open gap: P's TP ranks
  do not agree on a read of E's embeddings. D13 notes
  `image_grid_thw` is dropped with the pixels once leased.
- Harness facts follow #3416's defaults (g07, g08, g24 and HCA maps).
- The CLAUDE.md row marks the guide as the design of its PR stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@junyyang-amd

Copy link
Copy Markdown
Contributor Author

Round 2 pushed 6597890. All 5 points addressed; point 1 differently.

  1. Not moved to an issue: the E/P/D code is open in feat(mesh): declare encode workers beside prefill and decode #3408, feat(mesh): run E before P for image chat requests, falling back to PD #3409 and feat(engine): image embedding transport over Mooncake #3411 to feat(engine): image input in the ATOMesh standalone service #3413, and docs: ATOMesh multimodal image requests and E/P/D disaggregation design #3417 now merges after ci(atomesh): M3.1 image case in models_atomesh.yaml and its ci-case check #3415.
  2. No fork reference remains.
  3. The Acceptance table names the PR holding each result.
  4. Decode now reads as feat(engine): multimodal PD through the chat path #3410 implements it.
  5. The CLAUDE.md row marks a design.

Minor points done. The TP mixing was a real bug: fixed in #3412 @ dd0cf0e.

@valar-cop valar-cop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one wrong claim in D19/A8, rest looks fine..

ci green.

Comment thread docs/atomesh_multimodal_epd.md Outdated
**D19. The CI case is an M3.1 aggregated cell in `models_atomesh.yaml`.**
*#3415; #3413 serves images through the ATOMesh standalone service.*
- The cell `minimax-m31-flash-mxfp4-agg-tp4-mmmu` serves the recipe's
aggregated TP4 server through ATOMesh's standalone service

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the in-tree cell never sets USE_ATOMESH_ENTRYPOINTS, so it runs plain ATOM today.. either set it in the cell env or mark D19/A8 as planned?

junyyang-amd and others added 8 commits November 23, 2026 14:07
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s growing read buffer (D10, D11)

Follows #3412's review fixes at 65e5779.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#3698 replaced the Python standalone service, which #3413 extended, with a
Rust frontend that refuses images. The CI case was never served through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@junyyang-amd
junyyang-amd removed this pull request from stack #3730 November 24, 2026 05:24
@junyyang-amd
junyyang-amd added this pull request to stack #3768 November 24, 2026 05:24
junyyang-amd and others added 5 commits November 25, 2026 08:31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… follow-up

- D11: E->P goes through atom/ec_transfer (EcWriter.put / EcReader.get, a
  handle naming its transport); Mooncake is one backend and shares HCA
  selection with the KV connector through atom/utils/mooncake_hca.py.
  Records the follow-up of fetching at scheduling time, which would make a
  non-RDMA backend viable.
- D12: renamed classes; a generation of 0, a malformed handle and a reader
  that cannot start all fall back to the tower.
- D13: the handle's shape; P takes it only with --accept-ec-transfer-params.
- Changes per PR: new files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jgong5

jgong5 commented Nov 26, 2026

Copy link
Copy Markdown

Needs owner ruling: three design questions for this doc, from reviewing #3411 and #3412.

  1. Why fall back to P's tower rather than fail the request once E was used?
  2. What does the synchronous read inside run_model add to a cross-node, multi-image prefill step?
  3. Should P skip acquire when its prefix cache already covers every image span?
Context
  1. vLLM's Mooncake EC connector fails the request (retryable) when a push never arrives, and SGLang aborts a dispatched request on transfer failure; neither re-encodes on P. Fallback also means more tower work on P exactly when P is queued long enough for E's entry to expire. The doc records the fallback decision but not this load case.
  2. vLLM and SGLang finish the transfer before the request is scheduled; here the RDMA read sits on the prefill step's critical path. The doc lists the cross-node read as unmeasured.
  3. Today the scheduler sends the payload for every prefill chunk and embed_multimodal_batch acquires before the first image intersection, so a multi-turn chat whose image KV is already cached still reads E's rows (or runs the tower in PD), and E re-encodes the image every turn. Skipping when all spans end before the chunk start helps PD too; E could reuse a live entry by cache_seed.

junyyang-amd and others added 10 commits November 26, 2026 14:04
D12 follows #3411's round 4: each entry's generation, address and length
sit in a slot table apart from the rows; P syncs before the NIC writes and
compares all three; every None is logged and counted by reason. Records
reclaiming on a P ack in the slot's reserved field as the follow-up, and
the D13 handle gains the slot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unconfigured, mooncake_hca now picks the HCA on the GPU's own PCIe switch
from its PCI address, whatever the HCAs are named. D11 says so; the
acceptance runs' naming of HCAs (and g15's missing rdma<N>) becomes the
history of D8's runs, and matched rails is out for the one reason left: it
covers only the KV connector's writes, not E's pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D11: the EC backend and its helpers import nothing from kv_transfer; the
PCI topology is atom/utils/pci_topology.py. D12: one slot per 64 KiB of
the whole-GiB region, carved from its front, so space runs out before
slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants